{extend name="../../admin/view/main"}

{block name="button"}

{if auth("add")}
<button class='layui-btn layui-btn-sm layui-btn-primary' data-open='{:url("add")}'>添加债权</button>
{/if}

{/block}

{block name="content"}
<div class="layui-tab layui-tab-card">
    <div class="layui-tab-content">
        {include file='shop/property/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='list-table-check-td think-checkbox'>
                    <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
                </th>
                <th class='list-table-sort-td'>
                    <button class="layui-btn layui-btn-xs" data-reload type="button">刷 新</button>
                </th>
                <th class='text-left nowrap'>债权名称</th>
                <th class='text-left nowrap'>债权信息</th>
                <th class='text-left nowrap'>债权价值</th>
                <th class='text-left nowrap'>债权匹配</th>
                <th class='text-left nowrap'>债权状态</th>
                <th></th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td think-checkbox'>
                    <label><input class="list-check-box" type='checkbox' value='{$vo.id}'></label>
                </td>
                <td class='list-table-sort-td'>
                    <label><input class="list-sort-input" data-action-blur="{:request()->url()}" data-loading="false" data-value="id#{$vo.id};action#sort;sort#{value}" value="{$vo.sort}"></label>
                </td>
                <td class='nowrap'>
                    <div class="inline-block text-top sub-span-blue">
                        <div>债权名称：<span>{$vo.name|default='--'}</span></div>
                    </div>
                </td>
                <td>
                    <div class="inline-block text-top sub-span-blue">
                        <div>债权所属人：<span>{$vo.owner|default='--'}</span></div>
                        <div>债权抵押人：<span>{$vo.mortgagor|default='--'}</span></div>
                        <div>债权有效期：<span>{$vo.date|default='--'}</span></div>
                    </div>
                </td>
                <td>
                    <div class="inline-block text-top sub-span-blue">
                        <div>债权价值：<span>{$vo.cost|default='0.00'|number_format=2}</span></div>
                        <div>债权已匹配：<span>{$vo.match_cost|default='0.00'|number_format=2}</span></div>
                        <div>债权剩余匹配：<span>{$vo.cost + 0 - $vo.match_cost + 0|number_format=2}</span></div>
                    </div>
                </td>
                <td>
                    <div class="nowrap">
                        {if auth('order')}
                        <a class="layui-btn layui-btn-xs layui-btn-warm" data-modal='{:url("match")}?id={$vo.id}'>查看匹配</a>
                        {/if}
                        {if auth('freed')}
                        <a class="layui-btn layui-btn-xs layui-btn-danger" data-action='{:url("freed")}' data-confirm="确定要释放所有投资么？释放后匹配该债权的所有投资将被解抵！" data-value="id#{$vo.id}">释放所有</a>
                        {/if}
                    </div>
                </td>
                <td class='nowrap sub-strong-blue'>
                    {if auth("edit")}
                    <a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    {else}
                    <a class="layui-btn layui-btn-xs layui-btn-primary layui-disabled" data-tips-text="您没有编辑产品的权限哦！">编 辑</a>
                    {/if}

                    {if auth("remove")}
                    <a class="layui-btn layui-btn-xs layui-btn-danger" data-action="{:url('remove')}" data-confirm="确定要禁用该资产么？其资产可用债权将无法使用！" data-value="id#{$vo.id};deleted#1">删 除</a>
                    {/if}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}
